home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / dl_unix.pro < prev    next >
Text File  |  1997-07-08  |  3KB  |  97 lines

  1. ; $Id: dl_unix.pro,v 1.2 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1988-1997, Research Systems, Inc.  All rights reserved.
  4. ;    Unauthorized reproduction prohibited.
  5. ;
  6.  
  7. pro dl_unix, name, print=printflg, directory = direct, multi = multi
  8. ;+NODOCUMENT
  9. ; NAME:
  10. ;    DL_UNIX
  11. ;
  12. ; PURPOSE:
  13. ;    Extract the documentation template of one or more IDL modules
  14. ;    (procedures or functions).
  15. ;
  16. ; CATEGORY:
  17. ;    Help, documentation.
  18. ;
  19. ; CALLING SEQUENCE:
  20. ;    DL_UNIX        ;For prompting.
  21. ;    DL_UNIX, Name     ;Extract documentation for procedure Name using
  22. ;                the current !PATH.
  23. ;
  24. ; INPUTS:
  25. ;    Name:    The string containing the name of the procedure or "*" for all.
  26. ;    
  27. ; KEYWORDS:
  28. ;    PRINT:    If set, this keyword sends output of DL_UNIX to lpr.  If
  29. ;        PRINT is a string, it is interpreted as a shell
  30. ;        command used for output with the documentation from 
  31. ;        DL_UNIX providing standard input 
  32. ;        (i.e., PRINT="cat > junk").
  33. ;
  34. ;   DIRECTORY:    The directory to search.  If omitted, the current directory
  35. ;        and !PATH are used.
  36. ;
  37. ;    MULTI:    If set, this flag allows printing of more than one file if the
  38. ;        requested module exists in more than one directory in the path
  39. ;        and the current directory.
  40. ;
  41. ; OUTPUTS:
  42. ;    No explicit outputs.  Documentation is piped through "more" unless
  43. ;    /PRINT is specified.
  44. ;
  45. ; COMMON BLOCKS:
  46. ;    None.
  47. ;
  48. ; SIDE EFFECTS:
  49. ;    Output is produced on terminal or printer.
  50. ;
  51. ; RESTRICTIONS:
  52. ;    None.
  53. ;
  54. ; PROCEDURE:
  55. ;    Straightforward.
  56. ;
  57. ; MODIFICATION HISTORY:
  58. ;    DMS, Feb, 1988.
  59. ;    AB, 21 September 1992, renamed from DOC_LIB_UNIX to DL_UNIX to
  60. ;        avoid DOS filename limitations.
  61. ;-
  62.  
  63. on_error,2              ;Return to caller if an error occurs
  64. if n_elements(name) eq 0 then begin    ;Interactive query?
  65.     name = ''
  66.     printflg = 0    
  67.     read,'Name of procedure or * for all: ',name
  68.     read,'Enter 1 for printer, 0 for terminal: ',printflg
  69.     endif
  70. name = strlowcase(name)        ;make it always lower case
  71.  
  72. if n_elements(direct) eq 0 then path = ".:" + !path $    ;Directories to search
  73.     else path = direct
  74. if n_elements(printflg) eq 0 then output = " more " $
  75. else if strtrim(printflg,2) eq '1' then output = " lpr " $
  76. else if strtrim(printflg,2) eq '0' then output = " more " $
  77. else output = "'"+printflg+"' "
  78.  
  79. if n_elements(multi) le 0 then multi = 0    ;Only print once
  80. if strpos(name,"*") ge 0 then begin    ;Wild card?
  81.     multi = 1        ;allow printing of multiple files
  82.     endif
  83.  
  84. cmd = !dir + "/bin/doc_library "+output+strtrim(multi,2)+' ' ;Initial cmd
  85.     
  86. while strlen(path) gt 0 do begin ; Find it
  87.     i = strpos(path,":")
  88.     if i lt 0 then i = strlen(path)
  89.     file = strmid(path,0,i)+ "/" + name + ".pro"
  90. ;    print,"File: ",file
  91.     path = strmid(path,i+1,strlen(path))
  92.     cmd = cmd + ' ' + file
  93.     endwhile
  94. ;print,cmd
  95. spawn,cmd
  96. end
  97.